<?php

class FormElement_Link extends FormElement
{

  /**
   * @var string
   */
  public $url;

  public function render($row, $action)
  {
    switch ($action) {
      case Form::ACTION_VIEW :
      case Form::ACTION_INDEX :
        $this->beforeRender($row, $action);

        $url = Simplify::getResponse()->makeUrl($this->url, array($this->getField() => $this->getFieldValue($row, $this->getField())));

        $output = '<a href="'.$url.'">'.$this->getTitle().'</a>';

        $output = $this->afterRender($output, $row, $action);

        return $output;

        break;
    }

    return '';
  }

  public function setDataFromPost(&$row, $post, $action)
  {
  }

}

?>